package com.leetCode.max;

/**
 * Description:
 * Copyright:   Copyright (c)2019
 * Company:     zefu
 *
 * @author: 张李鑫
 * @version: 1.0
 * Create at:   2021-11-03 10:07:05
 * <p>
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2021-11-03     张李鑫                     1.0         1.0 Version
 */
public class Problem4 {
    /**
     *  反转数字 如果是0就忽略
     */


    public static int reverse(int x){
        boolean neg=((x>>>31)&1)==1;
        x=neg?x:-x;
        int m=Integer.MIN_VALUE;
        int o=Integer.MAX_VALUE;
        int res=0;
        while (x!=0){
            if (res<m||(res==m&&x%10<0)){
                return 0;
            }
            res=res*10+x%10;
        }
        return neg?res:Math.abs(res);
    }


}
